/**
 * @description spider
 * @author 盘古他爹
 */

import * as puppeteer from "puppeteer"



class Spider {
    host: string

    constructor(host: string) {
        this.host = host
    }
    //开启浏览器
    async openBrowser(headless: boolean = false) {
        const browser = await puppeteer.launch({ headless });
        const page = await browser.newPage();
        await page.goto(this.host);
        return page
        await page.screenshot({ path: 'example.png' });
    }

    //截图
    async screenShot() {
        const page = await this.openBrowser()
        return await page.screenshot();
    }

}

export {
    Spider
}